package com.leetcode_mianshi_150.tree;

/**
 * @author: 临晖
 * @since: 2024-05-11
 */
public class Trie {

    String world;
    Trie[] children;

    public Trie() {
        this.world = "";
        children = new Trie[26];
    }

    public void insert(String world) {
        Trie curr = this;
        for (int i = 0; i < world.length(); i++) {
            char op = world.charAt(i);
            if (curr.children[op - 'a'] == null){
                curr.children[op - 'a'] = new Trie();
            }
            curr = curr.children[op - 'a'];
        }

        curr.world = world;
    }
}
